package niverapps.com.utils;

import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages {
	private String BUNDLE_NAME = "niverapps.com.utils.messages"; //$NON-NLS-1$
	public static final int SPANISH = 1; 

	private final ResourceBundle RESOURCE_BUNDLE;
	private Locale currentLocale;	

	public Messages(int codeLanguange) {
		currentLocale =  Locale.ENGLISH;
		switch (codeLanguange) {
		case SPANISH:
			currentLocale = new Locale("ES");
		}
		RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME,currentLocale);
	}

	public String getString(String key) {
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			return '!' + key + '!';
		}
	}
}
